import request from '@/utils/request'

// 广告列表查询
export function fetchAdList(data) {
  return request({
    url: '/advertisement/advertisement/list',
    method: 'post',
    data
  })
}

// 删除广告（支持单删和批量删除）
export function deleteAd(ids) {
  return request({
    url: '/advertisement/advertisement/del',
    method: 'post',
    data: ids
  })
}

// 更新广告状态（上下线）
export function updateAdStatus(id) {
  return request({
    url: `/advertisement/advertisement/updStatus/${id}`,
    method: 'get',
    params: { id: { id } } // 两层对象包裹
  })
}

// 获取广告位置列表
export function fetchPositionList() {
  return request({
    url: '/advertisement/position/list',
    method: 'get'
  })
}

// 获取目标客户（人群）列表
export function fetchTargetAudienceList(params) {
  return request({
    url: '/advertisement/targetAudience/list',
    method: 'get',
    params
  })
}

// 添加广告
export function addAdvertisement(data) {
  return request({
    url: '/advertisement/advertisement/addAdvertisement',
    method: 'post',
    data
  })
}
